package com.sk.sourcecircle.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sk.sourcecircle.R;
import com.sk.sourcecircle.entity.MyFriendBean;

import java.util.List;

/**
 * Created by sk on 2018/1/7.
 */

public class NewFriendAdapter extends BaseQuickAdapter<MyFriendBean.DataBeanX.DataBean,BaseViewHolder> {

    public NewFriendAdapter(int layoutResId, @Nullable List<MyFriendBean.DataBeanX.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MyFriendBean.DataBeanX.DataBean item) {
        if(item.getUser_info()!=null){
            helper.setText(R.id.tv_name,item.getUser_info().getNickname());
            Glide.with(mContext).load(item.getUser_info().getHead_url()).apply(RequestOptions.bitmapTransform(new CircleCrop())).into((ImageView) helper.getView(R.id.head_img));
        }
        helper.addOnClickListener(R.id.pass);

        if(item.getStatus() == 0){
            helper.setGone(R.id.pass,true);
            helper.setGone(R.id.already_pass,false);
        }else{
            helper.setGone(R.id.pass,false);
            helper.setGone(R.id.already_pass,true);
        }

    }
}
